# -*- coding:utf8 -*-
import json
from datetime import datetime, date
from decimal import Decimal


class CJsonEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, datetime):
            return obj.strftime('%Y-%m-%d %H:%M:%S')
        elif isinstance(obj, date):
            return obj.strftime('%Y-%m-%d')
        elif isinstance(obj, Decimal):
            return obj.__str__()
        else:
            return json.JSONEncoder.default(self, obj)


if __name__ == '__main__':
    print(CJsonEncoder().default(Decimal('2.034')))